<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>获取已注册的流类型</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.stream-get-wrappers" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">stream_get_wrappers</h1>
  <p class="verinfo">(PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">stream_get_wrappers</span> &mdash; <span class="dc-title">获取已注册的流类型</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.stream-get-wrappers-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>stream_get_wrappers</strong></span>
    ( <span class="methodparam">void</span>
   ) : <span class="type">array</span></div>

  <p class="para rdfs-comment">
   获取在当前运行系统中已经注册并可使用的流类型列表。
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.stream-get-wrappers-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回一个索引数组，该数组里包含了当前运行系统中可使用的流类型的名称。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.stream-get-wrappers-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4826">
    <p><strong>Example #1 <span class="function"><strong>stream_get_wrappers()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">stream_get_wrappers</span><span style="color: #007700">());<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Array
(
    [0] =&gt; php
    [1] =&gt; file
    [2] =&gt; http
    [3] =&gt; ftp
    [4] =&gt; compress.bzip2
    [5] =&gt; compress.zlib
)
</pre></div>
    </div>
   </div>
  </p>
  <p class="para">
   <div class="example" id="stream-context-get-default.example.basic">
    <p><strong>Example #2 检查一个流类型是否存在</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;check&nbsp;for&nbsp;the&nbsp;existence&nbsp;of&nbsp;the&nbsp;bzip2&nbsp;stream&nbsp;wrapper<br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">in_array</span><span style="color: #007700">(</span><span style="color: #DD0000">'compress.bzip2'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">stream_get_wrappers</span><span style="color: #007700">()))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'compress.bzip2://&nbsp;support&nbsp;enabled.'</span><span style="color: #007700">;<br />}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">'compress.bzip2://&nbsp;support&nbsp;not&nbsp;enabled.'</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.stream-get-wrappers-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member"><span class="function"><a href="stream_wrapper_register.html" class="function" rel="rdfs-seeAlso">stream_wrapper_register()</a> - 注册一个用 PHP 类实现的 URL 封装协议</span></li>
  </ul>
 </div>

</div></div></div></body></html>